#include <iostream>
#include "dvoPresenter.h"
#include "dvo.h"
#include "elements_test.h"
#include "fibonacci.h"
#include "parallel_operation.h"
#include "cipher.h"
#include "msg_handler.h"


int main()
{
    elements_test();
    std::cout << std::endl << "Presentation for dvo items begin" << std::endl;
    dvo::ps::SimpleTransceiver<dvoPresenter, dvoPresenter> tester = [](dvoPresenter& item)->dvoPresenter 
     {std::cout << "Test for " << item.GetName() << " is " << (item.Test()?"success":"failed") << std::endl; return item;};
    dvo::ps::SimpleTransceiver<dvoPresenter, dvoPresenter> runner = [](dvoPresenter& item)->dvoPresenter 
     {std::cout << "Run " << item.GetName() << std::endl; item.Run(); return item;};
    dvo::ps::SimpleReceiver<dvoPresenter> ender = [](dvoPresenter& item) 
     {std::cout << "Presentation for " << item.GetName() << " is done." << std::endl << std::endl; };

    *tester.Output() >> runner.Input();
    *runner.Output() >> ender.Input();

    std::vector<dvoPresenter> items;
    items.push_back(dvoPresenter("Pullflow Fibonacci sequencer", test_fb_pl, run_fb_pl));
    items.push_back(dvoPresenter("Pushflow Fibonacci sequencer", test_fb_ps, run_fb_ps));
    items.push_back(dvoPresenter("Simple cipher", test_cipher, run_cipher));
    items.push_back(dvoPresenter("Message handler", test_msg_handler, run_msg_handler));
    items.push_back(dvoPresenter("Parallel operations", test_po, run_po));

    for(auto& item : items) item >> *tester.Input();
	
	int i;
	std::cin >> i;
}